home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
escalant
/
escala21.lha
/
escalante2.1
/
src
/
editor
/
EscalanteCommands.h
< prev
next >
Wrap
C/C++ Source or Header
|
1993-07-15
|
7KB
|
382 lines
//
// Copyright (C) 1993 Jeff McWhirter
//
#ifndef DRAWCOMMANDS_H
#define DRAWCOMMANDS_H
#include "EscalanteGlobal.h"
#include "Command.h"
#include "CommonGfx.h"
#include "Set.h"
#include "Alert.h"
class BaseEscalanteView;
class EscalanteView;
class PtsGfx;
class VRelation;
class VGraphElement;
class VEntity;
class GroupPicker :public Command{
public:
bool newgroup;
class Class * cl;
BaseEscalanteView * view;
GroupPicker(BaseEscalanteView * v,bool newg = TRUE,class Class * cl =0);
Command *TrackMouse(TrackPhase, Point, Point, Point);
};
class EscalanteCommand: public Command{
public:
bool dopoint;
BaseEscalanteView * view;
EscalanteCommand(BaseEscalanteView * v = 0){view = v;dopoint = TRUE;}
void TrackConstrain(Point, Point, Point *np);
Point DoPoint(Point p);
};
class MultiVCommand: public EscalanteCommand{
public:
bool doall;
MultiVCommand(BaseEscalanteView * v = 0,bool all = FALSE):EscalanteCommand(v){doall = all;}
};
enum MoverFlags{ eMCDoneFirst = BIT(eCmdLast+1)};
class MoverCommand : public MultiVCommand{
public:
Point lastP;
bool h_or_v;
Object * obj;
int HOrVType;
Rectangle rect;
Point doitdelta;
Point delta;
MoverCommand(Object * o,BaseEscalanteView * v = 0, bool all = FALSE,bool horvert = FALSE):MultiVCommand(v,all){
obj = o;
if(obj) obj->AddObserver(this);
lastP = gPoint0;
DoneFirst(FALSE);
h_or_v = horvert;
SetName("Move");
doitdelta = gPoint0;
delta = gPoint0;
//0 ->any move, 1 -> hor, 2 = vert
HOrVType =0;
}
~MoverCommand(){
if(obj) obj->RemoveObserver(this);
}
void DoObserve(int id, int part, void *d , Object *op);
Command *TrackMouse(TrackPhase, Point, Point, Point);
bool OkToMoveBy(Point & deltaP, Point np);
bool OkToMoveTo(Point &np, int coarse = 1);
bool DoneFirst() {return TestFlag(eMCDoneFirst);}
void DoneFirst(bool b) { SetFlag(eMCDoneFirst,b);}
virtual void MoveBy(Point){}
void DoIt();
void UndoIt();
};
class RectDrawer :public MoverCommand{
public:
RectDrawer(BaseEscalanteView * v):MoverCommand(0,v){}
Command *TrackMouse(TrackPhase, Point, Point, Point);
};
class JointMover: public MoverCommand {
int jix;
public:
JointMover( VGraphElement * e,
int ix,
BaseEscalanteView * view = 0,
bool all = FALSE,
bool hv = FALSE): MoverCommand((Object*)e,view,all,hv){
jix = ix;
SetName("Move Joint");
}
Command *TrackMouse(TrackPhase, Point, Point, Point);
void MoveBy(Point);
};
class ElementMover: public MoverCommand {
public:
ElementMover(VGraphElement * pe,
BaseEscalanteView * view = 0,
bool all = FALSE,
bool hv = FALSE): MoverCommand((Object*)pe,view,all,hv){
SetName("Move");
}
Command *TrackMouse(TrackPhase, Point, Point, Point);
void MoveBy(Point);
};
class GfxStretcher: public MoverCommand {
int ptix;
public:
GfxStretcher(PtsGfx* pg,
int pix,
BaseEscalanteView * view = 0,
bool all = FALSE): MoverCommand((Object*)pg,view,all){
ptix = pix;
dopoint = FALSE;
SetName("Gfx Stretch");
}
Command *TrackMouse(TrackPhase, Point, Point, Point);
void MoveBy(Point);
};
class GfxMover: public MoverCommand {
public:
GfxMover(PtsGfx* g,
BaseEscalanteView * view = 0,
bool all = FALSE):MoverCommand((Object*)g,view,all){
dopoint = FALSE;
SetName("Gfx Move");
}
Command *TrackMouse(TrackPhase, Point, Point, Point);
void MoveBy(Point);
};
class EltStretcher: public MoverCommand {
LocPt lp;
Rectangle r;
bool ds;
public:
EltStretcher(VGraphElement * elt,
LocPt p = cLPNull,
BaseEscalanteView * view = 0,
bool all = FALSE,
bool doublestretch = FALSE,
bool hv = FALSE):MoverCommand((Object*)elt,view,all,hv) {
r= gRect0;
lp =p;
ds = doublestretch;
SetName("Reshape");
}
Command *TrackMouse(TrackPhase, Point, Point, Point);
void MoveBy(Point);
};
class Rotator: public MultiVCommand {
VGraphElement * elt;
public:
Rotator(VGraphElement * pe,
BaseEscalanteView * view = 0,
bool all = FALSE):MultiVCommand(view,all){elt = pe;}
Command *TrackMouse(TrackPhase, Point, Point, Point);
};
class GraphCommand: public MoverCommand{
public:
class VGraphElement * vgraph;
GraphCommand(VGraphElement * vg,
BaseEscalanteView * view = 0):MoverCommand(0,view){vgraph = vg;}
};
class QuickMover: public MoverCommand {
bool firstrelease;
Point p;
public:
QuickMover(VGraphElement * pe,
Point pt,
BaseEscalanteView * view = 0,
bool all = FALSE):MoverCommand((Object*)pe,view,all){
p = pt;
firstrelease = FALSE;
SetFlag(eCmdMoveEvents);
}
Command *TrackMouse(TrackPhase, Point, Point, Point);
void MoveBy(Point);
};
class DeleterAdder :public GraphCommand{
public:
Set sset;
Set vset;
bool state;
DeleterAdder(VGraphElement * vg,
BaseEscalanteView * view):GraphCommand(vg,view){
state = TRUE;
}
~DeleterAdder();
void DoObserve(int id, int part, void *d , Object *op);
void Init();
Command *TrackMouse(TrackPhase, Point, Point, Point);
};
class EltAdder :public DeleterAdder{
public:
EltAdder(VGraphElement * vg,BaseEscalanteView * view):DeleterAdder(vg,view){
SetName("Add");
}
void DoIt();
void UndoIt();
void Commit();
void SaveElements();
};
class ElementDeleter :public DeleterAdder{
public:
ElementDeleter(VGraphElement * vg,BaseEscalanteView * view):DeleterAdder(vg,view){
SetName("Delete");
}
void DoIt();
void UndoIt();
void Commit();
};
#define RelationAdder_BASE EltAdder
class RelationAdder: public EltAdder {
public:
class VRelation * rel;
bool firstrelease;
bool hadrelease;
RelationAdder(class VRelation * vr,VGraphElement * vg,BaseEscalanteView * view = 0);
Command *TrackMouse(TrackPhase, Point, Point, Point);
Command * StoppedAdding();
};
#define ElementAdder_BASE EltAdder
class ElementAdder: public EltAdder {
public:
class VGraphElement * elt;
bool firstrelease;
bool hadrelease;
ElementAdder(class VGraphElement * vg,VGraphElement * vg,BaseEscalanteView * view = 0);
Command *TrackMouse(TrackPhase, Point, Point, Point);
};
#define MultiAdder_BASE EltAdder
class MultiAdder: public EltAdder {
public:
int done;
class VGraphElement * proto;
MultiAdder(class VGraphElement * prototype,VGraphElement * vg,BaseEscalanteView * view = 0);
Command *TrackMouse(TrackPhase, Point, Point, Point);
};
#define EltSetter_BASE GraphCommand
class EltSetter: public GraphCommand {
class VRelation * rel;
bool firstrelease;
bool tail;
class Class * c;
public:
EltSetter(class VRelation * vr,bool tl, VGraphElement * vg,class Class *cl =0,BaseEscalanteView * view = 0);
Command *TrackMouse(TrackPhase, Point, Point, Point);
};
class HeadSetter: public EltSetter {
public:
HeadSetter(class VRelation * vr, VGraphElement * vg, class Class *cl =0,BaseEscalanteView * view = 0):EltSetter(vr,FALSE,vg,cl,view){}
};
class TailSetter: public EltSetter {
public:
TailSetter(class VRelation * vr, VGraphElement * vg,class Class *cl =0, BaseEscalanteView * view = 0):EltSetter(vr,TRUE,vg,cl,view){}
};
#endif DRAWCOMMANDS_H